<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Material of Analysis | 配置</title>
    <meta name="description" content="The analytical data that you often use to learn">
    <link rel="icon" href="/material/logo.png">
  <link rel="manifest" href="/material/manifest.json">
  <meta name="theme-color" content="#3eaf7c">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <link rel="apple-touch-icon" href="/material/icons/apple-touch-icon-152x152.png">
  <link rel="mask-icon" href="/material/icons/safari-pinned-tab.svg" color="#3eaf7c">
  <meta name="msapplication-TileImage" content="/icons/msapplication-icon-144x144.png">
  <meta name="msapplication-TileColor" content="#000000">
    
    <link rel="preload" href="/material/assets/css/0.styles.89749010.css" as="style"><link rel="preload" href="/material/assets/js/app.671f232e.js" as="script"><link rel="preload" href="/material/assets/js/7.23741c7b.js" as="script"><link rel="prefetch" href="/material/assets/js/9.6ad28882.js"><link rel="prefetch" href="/material/assets/js/1.a893eea4.js"><link rel="prefetch" href="/material/assets/js/2.ad32dd32.js"><link rel="prefetch" href="/material/assets/js/3.2af42d2c.js"><link rel="prefetch" href="/material/assets/js/4.b8a50edf.js"><link rel="prefetch" href="/material/assets/js/5.3a34f633.js"><link rel="prefetch" href="/material/assets/js/6.36baf8b1.js"><link rel="prefetch" href="/material/assets/js/8.0b506f6a.js"><link rel="prefetch" href="/material/assets/js/10.aa5bc1f8.js"><link rel="prefetch" href="/material/assets/js/11.b5d01b0b.js"><link rel="prefetch" href="/material/assets/js/12.2aab57fe.js"><link rel="prefetch" href="/material/assets/js/13.17c8fcb3.js"><link rel="prefetch" href="/material/assets/js/14.b0d8de38.js"><link rel="prefetch" href="/material/assets/js/15.95c4b4d8.js"><link rel="prefetch" href="/material/assets/js/16.8279b098.js"><link rel="prefetch" href="/material/assets/js/17.c88c3a9c.js"><link rel="prefetch" href="/material/assets/js/18.0635186f.js"><link rel="prefetch" href="/material/assets/js/19.5e722a99.js">
    <link rel="stylesheet" href="/material/assets/css/0.styles.89749010.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div><a href="/material/" class="home-link router-link-active"><!----><span class="site-name">
      Material of Analysis
    </span></a><div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""><!----></div><nav class="nav-links can-hide"><div class="nav-item"><a href="/material/basic/" class="nav-link">基础</a></div><a href="https://github.com/docschina/vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav></div></header><div class="sidebar-mask"></div><div class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/material/basic/" class="nav-link">基础</a></div><a href="https://github.com/docschina/vuepress" target="_blank" rel="noopener noreferrer" class="repo-link">
    GitHub
    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a></nav><!----></div><div class="page"><div class="content"><h1 id="配置"><a href="#配置" aria-hidden="true" class="header-anchor">#</a> 配置</h1><h2 id="配置文件-config-file"><a href="#配置文件-config-file" aria-hidden="true" class="header-anchor">#</a> 配置文件(config file)</h2><p>不做任何配置的话，页面会显得过于简单，用户也无法方便地浏览网站。想要定制你的网站，首先需要在文档目录中创建一个 <code>.vuepress</code> 目录。这是放置所有 VuePress 特有(VuePress-specific) 文件的地方。</p><p>配置 VuePress 站点的基本文件是 <code>.vuepress/config.js</code>，其中导出一个 JavaScript 对象：</p><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  title<span class="token punctuation">:</span> <span class="token string">'Hello VuePress'</span><span class="token punctuation">,</span>
  description<span class="token punctuation">:</span> <span class="token string">'Just playing around'</span>
<span class="token punctuation">}</span>
</code></pre><p>如果开发服务器正常运行，你应该看到该页面现在有一个 title 标题和一个搜索框。VuePress 带有内置的 基于 header 搜索(headers-based search) 的功能 - 它会自动从所有页面的 title, <code>h2</code> 和 <code>h3</code> header 标签中，建立一个简单的搜索索引。（译者注：此搜索是遍历 pages 数组的每一项，取出其中的 headers 数组，其中数组每项对应 markdown 标题，具体代码查看 /lib/default-theme/SearchBox.vue 的 suggestions 函数）</p><p>请查阅 <a href="/material/config/">配置参考</a> 以获取完整的选项列表。</p><div class="tip custom-block"><p class="custom-block-title">可替代的配置格式</p><p>你也可以使用 YAML(<code>.vuepress/config.yml</code>) 或 TOML(<code>.vuepress/config.toml</code>) 格式编写配置文件。</p></div><h2 id="主题配置-theme-configuration"><a href="#主题配置-theme-configuration" aria-hidden="true" class="header-anchor">#</a> 主题配置(theme configuration)</h2><p>VuePress 主题，负责网站的所有布局和交互细节。VuePress 附带一个默认主题（你现在看到的就是），专门为技术文档设计。它暴露许多选项，允许你自定义导航栏(navbar)、侧边栏(sidebar)和主页(homepage)等。详细信息请查看 <a href="/material/default-theme-config/">默认主题配置</a> 页面。</p><p>如果你想开发自定义主题，请参考 <a href="/material/guide/custom-themes.html">自定义主题</a>。</p><h2 id="应用程序级别的增强功能-app-level-enhancements"><a href="#应用程序级别的增强功能-app-level-enhancements" aria-hidden="true" class="header-anchor">#</a> 应用程序级别的增强功能(app level enhancements)</h2><p>由于 VuePress 应用是一个标准的 Vue 应用程序，所以你可以通过创建一个 <code>.vuepress/enhanceApp.js</code> 文件，来使用应用程序级别的增强功能，如果此文件存在，该文件将会被导入到该应用程序中。该文件应该通过  <code>export default</code> 方式导出一个钩子函数，它将接收一个含有一些应用程序级别值的对象作为参数。你可以使用这个钩子来安装额外的 Vue 插件，注册全局组件，或者添加额外的路由钩子：</p><pre class="language-js"><code><span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">(</span><span class="token punctuation">{</span>
  Vue<span class="token punctuation">,</span> <span class="token comment">// 当前 VuePress 应用所使用的 Vue 版本</span>
  options<span class="token punctuation">,</span> <span class="token comment">// 根 Vue 实例的选项</span>
  router<span class="token punctuation">,</span> <span class="token comment">// 应用程序的路由实例</span>
  siteData <span class="token comment">// 网站元数据</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
  <span class="token comment">// ...使用应用程序级别的增强功能</span>
<span class="token punctuation">}</span>
</code></pre><hr><blockquote><p>原文：<a href="https://vuepress.vuejs.org/guide/basic-config.html" target="_blank" rel="noopener noreferrer">https://vuepress.vuejs.org/guide/basic-config.html</a></p></blockquote><hr></div><div class="content edit-link"><a href="https://github.com/docschina/vuepress/edit/master/docs/guide/basic-config.md" target="_blank" rel="noopener noreferrer">在GitHub上编辑此页</a><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></div><!----></div></div></div>
    <script src="/material/assets/js/7.23741c7b.js" defer></script><script src="/material/assets/js/app.671f232e.js" defer></script>
  </body>
</html>
